package com.sz.sidi.dao.hibernate;

import java.io.Serializable;
import java.util.List;

import com.sz.sidi.entity.TuserInfo;
import com.sz.sidi.exceptions.DaoException;

public interface BaseHbDao {
	public List<TuserInfo> getHbUserInfo();
	
	/**
	 * @param obj
	 * @return
	 * @throws DaoException
	 *             更新实体
	 */
	public boolean insert(Object obj) throws DaoException;

	/**
	 * @param obj
	 * @return
	 * @throws DaoException
	 *             删除实体
	 */
	public boolean delete(Object obj) throws DaoException;

	public void deleteAll(List obj)throws DaoException;
	/**
	 * @param obj
	 * @return
	 * @throws DaoException
	 *             更新实体�޸�
	 */
	public boolean edit(Object obj) throws DaoException;

	/**
	 * @param hql
	 * @return
	 * @throws DaoException
	 *             查询HQL语句
	 */
	public List find(String hql) throws DaoException;

	/**
	 * 保存实体，返回保存好的实体
	 * @param obj
	 * @return
	 * @throws DaoException
	 */
	public Object save(Object obj) throws DaoException;
	
	/**
	 * @param obj
	 * @return
	 * @throws DaoException
	 *             保存或更新实体
	 */
	public boolean saveOrUpdate(Object obj) throws DaoException;

	public boolean merge(Object obj) throws DaoException;
	/**
	 * @param list
	 * @return
	 * @throws DaoException
	 *             保存或更新实体集合
	 */
	public boolean saveOrUpdateAll(List list) throws DaoException;

	/** 
	 * @param objectClass
	 * @return
	 * @throws DaoException
	 * 			 根据实体类，从表中获取所有实体对象
	 */
	public List getAllEntity(Class objectClass) throws DaoException;
	
	/**
	 * @param objectClass
	 * @param key
	 * @return
	 * @throws DaoException
	 *             根据Class及主键，查询实体
	 */
	public Object getEntity(Class objectClass, Serializable key)
			throws DaoException;

	/**
	 * @param objectName
	 * @param key
	 * @return
	 * @throws DaoException
	 *             根据实体名及主键，查询实体
	 */
	public Object getEntity(String objectName, Serializable key)
			throws DaoException;

	/**
	 * @param operFlag
	 *             0、新增或修改 1、新增 2、修改 3、删除
	 * @param obj
	 * @return
	 * @throws BusinessException
	 *             根据标示修改实体
	 */
	public boolean updateObjByOperFlag(int operFlag, Object obj)
			throws DaoException;

	/**
	 * @param operFlag
	 *             0、新增或修改 1、新增 2、修改 3、删除
	 * @param obj
	 * @param id
	 *            主键
	 * @return
	 * @throws BusinessException
	 */
	public boolean updateObjByOperFlag(int operFlag, Object obj, Serializable id)
			throws DaoException;
	
	
	public Object findEntityByKey(Class objClass, Serializable keyObj)	throws DaoException ;
	
	public List findByExample(Object obj,Serializable id)throws DaoException;
	
	public boolean mergeAll(List objList) throws DaoException;
}
